/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2024-08-19
 * Time: 21:36
 */
public class main {

    public static void main(String[] args) {
        
    }
        public MySingleList.ListNode mergeTwoLists(MySingleList.ListNode headA, MySingleList.ListNode headB) {
            MySingleList.ListNode newHead = new MySingleList.ListNode(-1);
            MySingleList.ListNode tmp = new MySingleList.ListNode(-21);
            while(headA != null && headB != null){
                if(headA.val < headB.val){
                    tmp.next = headA;
                    headA = headA.next;
                    tmp = tmp.next;
                }else{
                    tmp.next = headB;
                    headB = headB.next;
                    tmp = tmp.next;
                }
            }
            if(headA != null){
                tmp.next = headA;
            }
            if(headB != null){
                tmp.next = headB;
            }
            return newHead;
        }

    public static void main1(String[] args) {
        IList list = new MySingleList();
        list.createList();
        list.display();

        System.out.println("=======");
        //list.reverse();
        //list.display();
        //System.out.println(list.middlePoint());
        System.out.println(list.returns(2));
    }
}
